[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode, Pack = 8)]
public struct COMPONENT
{
private const int INTERNET_MAX_URL_LENGTH = 2084; // = INTERNET_MAX_SCHEME_LENGTH (32) + "://\0".Length + INTERNET_MAX_PATH_LENGTH (2048)
public static readonly int SizeOf = Marshal.SizeOf(typeof(COMPONENT));
public int dwSize;
public int dwID;
public CompType iComponentType;
[MarshalAs(UnmanagedType.Bool)]
public bool fChecked;
[MarshalAs(UnmanagedType.Bool)]
public bool fDirty;
[MarshalAs(UnmanagedType.Bool)]
public bool fNoScroll;
public COMPPOS cpPos;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=260)]
public string wszFriendlyName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=INTERNET_MAX_URL_LENGTH)]
public string wszSource;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=INTERNET_MAX_URL_LENGTH)]
public string wszSubscribedURL;
public int dwCurItemState;
public COMPSTATEINFO csiOriginal;
public COMPSTATEINFO csiRestored;
}
Structure COMPONENT
Public TODO
End Structure
None.
static readonly Guid CLSID_ActiveDesktop = new Guid("{75048700-EF1F-11D0-9888-006097DEACF9}");
public static IActiveDesktop GetActiveDesktop()
{
Type typeActiveDesktop = Type.GetTypeFromCLSID(CLSID_ActiveDesktop);
return (IActiveDesktop) Activator.CreateInstance(typeActiveDesktop);
}
IActiveDesktop dt = GetActiveDesktop();
int iCount;
dt.GetDesktopItemCount( out iCount, 0 );
COMPONENT comp = new COMPONENT();
for ( int i = 0; i < iCount; i++ )
{
comp.dwSize = COMPONENT.SizeOf;
dt.GetDesktopItem( i, ref comp, 0 );
//...
}
.